<?php
/**
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file license.txt or that can be found at 
 * http://code.google.com/p/billboardce/wiki/License.
 *
 * @package    Transition_Module
 * @category   Model
 * @license    http://code.google.com/p/billboardce/wiki/License New BSD License
 * @version    SVN: $Id: $
 */
class Slide_Plugin_Transition extends Bbce_Slide_Plugin_Abstract
{
    /**
     * Title of the plugin, as shown in the interface
     * 
     * @var string
     */    
    protected $_title = 'Transition';
    
    /**
     * Description of the plugin, as shown in the interface
     * 
     * @var string
     */    
    protected $_description = 'Controls slide transition effects.';
    
    /**
     * Generates a Zend_Form object which is displayed when
     * editing the given plugin.  The $values array is
     * a key => value associative array that maps the form
     * field names with their default values, if any.
     * 
     * @param array $values
     * @return object Zend_Form
     */    
    public function getConfigurationForm($values = array())
    {
        $transitionTypes = array(
            'none'        => 'None',
            'blindX'      => 'Blind X',
            'blindY'      => 'Blind Y',
            'blindZ'      => 'Blind Z',
            'cover'       => 'Cover',
            'curtainX'    => 'Curtain X',
            'curtainY'    => 'Curtain Y',
            'fade'        => 'Fade',
            'fadeZoom'    => 'Fade Zoom',
            'growX'       => 'Grow X',
            'growY'       => 'Grow Y',
            'scrollUp'    => 'Scroll Up',
            'scrollDown'  => 'Scroll Down',
            'scrollLeft'  => 'Scroll Left',
            'scrollRight' => 'Scroll Right',
            'scrollHorz'  => 'Scroll Horizontal',
            'scrollVert'  => 'Scroll Vertical',
            'slideX'      => 'Slide X',
            'slideY'      => 'Slide Y',
            'turnUp'      => 'Turn Up',
            'turnDown'    => 'Turn Down',
            'turnLeft'    => 'Turn Left',
            'turnRight'   => 'Turn Right',
            'uncover'     => 'Uncover',
            'wipe'        => 'Wipe',
            'zoom'        => 'Zoom'
        ); 

        $form = new Zend_Form();
        $form->setAttrib('class', 'slideOptionForm')
             ->setDecorators(array(
                     'FormElements',
                     array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')),
                     'Form'
             ));
             
        $transition = $form->createElement('select', 'transition', array('label' => 'Transition:'));
        $transition->setRequired(false)
                   ->setMultiOptions($transitionTypes)
                   ->setValue(isset($values['transition']) ? $values['transition'] : 'none');
        
        $form->addElements(array($transition));

        $form->setElementDecorators(array(
                  'ViewHelper',
                  'Errors',
                  array('HtmlTag', array('tag' => 'div', 'class' => 'elm')),
                  array('Label', array('tag' => 'span')),
              ));
        
        return $form;
    }
}